package security.core.source.service;

import java.util.Map;
import java.util.Set;

import security.debug.RBACLogger;

public abstract class PermissionSourceService {
	private Map<String, Set<String>> permissionResourcesMap;
	
	public PermissionSourceService() {
		if (RBACLogger.debug()) {
			RBACLogger.log("PermissionSourceService#PermissionSourceService is called!");
		}
		this.permissionResourcesMap = loadResources();
	}
	
	public Map<String, Set<String>> getPermissionResourcesMap() {
		return this.permissionResourcesMap;
	}
	
	/*
	 * this method should construct a map, which map a permission with a set of resource URLs, using
	 * permission(String) as key and roles(Set<String>) as value.
	 * this method will be called by the constructor and the returned map will be assigned to local
	 * data member permissionResourcesMap.
	 * 
	 * @return Map<String, Set<String>>
	 */
	public abstract Map<String, Set<String>> loadResources();
}
